package com.stox.services.data.provider.repository.file;

import org.springframework.stereotype.Component;

import com.stox.services.core.repository.AbstractCachingFileRepository;
import com.stox.services.data.provider.repository.ExchangeRepository;
import com.stox.shared.model.Exchange;

@Component
public class ExchangeFileRepository extends AbstractCachingFileRepository<Exchange> implements ExchangeRepository{

	public ExchangeFileRepository() {
		super("exchange");
	}
	
	@Override
	public Exchange deserialize(String text) {
		return new Exchange(text);
	}

	@Override
	public String serialize(Exchange entity) {
		return entity.toString();
	}
	
	@Override
	public void saveAndFlush(Exchange exchange) {
		saveOrUpdate(exchange);
		commit();
	}

}
